package reflect;

import domin.Student;

/*
获取字节码文件的三种方法
 */
public class Demo1 {
    public static void main(String[] args) throws ClassNotFoundException {

        //1.通过Class的静态方法forName
        Class<?> class1 = Class.forName("domin.Student");
        //2。类目.class
        Class<Student> class2 = Student.class;
        //3。Object中的getClass()
        Student student = new Student();
        Class<? extends Student> class3 = student.getClass();
        //类的字节码对象只有一份，三个是相同的
        System.out.println(class1);
        System.out.println(class2);
        System.out.println(class3);
    }
}
